package com.cai.servlet.admin;

import com.cai.dao.DetailedUserDao;
import com.cai.dao.impl.DetailedUserDaoImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author RuoLi
 */
@WebServlet(name = "ServletAdminDetailed", value = "/admin/DetailedInfo")
public class ServletAdminDetailedInfo extends HttpServlet {
    DetailedUserDao detailedUserDao = new DetailedUserDaoImpl();
    static int userAccount = -1;

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //用户登录后发送请求获取数据
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        //接收session id 查询账号
        response.getWriter().write(detailedUserDao.showUserDetailedInfo(userAccount));
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        userAccount = Integer.parseInt(request.getParameter("userAccount"));
    }
}
